home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 06 - 1990 / 06.07 Jul 90 / C++ micro-Draw ƒ / ListDoc.cp < prev    next >
Encoding:
Text File  |  1990-05-20  |  1.2 KB  |  63 lines  |  [TEXT/MPS ]

  1. #include <Types.h>
  2. #include <QuickDraw.h>
  3. #include <Fonts.h>
  4. #include <Events.h>
  5. #include <Controls.h>
  6. #include <Windows.h>
  7. #include <Menus.h>
  8. #include <TextEdit.h>
  9. #include <Dialogs.h>
  10. #include <Desk.h>
  11. #include <Scrap.h>
  12. #include <ToolUtils.h>
  13. #include <Memory.h>
  14. #include <SegLoad.h>
  15. #include <Files.h>
  16. #include <OSUtils.h>
  17. #include <Traps.h>
  18. #include <StdLib.h>
  19.  
  20. #include "TDocument.h"
  21. #include "DisplList.h"
  22. #include "ListDoc.h"
  23.  
  24. // create and delete the document window
  25.  
  26. TListDoc::TListDoc(short resID)    : (resID)
  27. {
  28.     fObjList = new TObjList();
  29.     ShowWindow(fDocWindow);    
  30. }
  31.  
  32. TListDoc::~TListDoc(void)
  33. {
  34.     delete fObjList;
  35.     HideWindow(fDocWindow);
  36. }
  37.  
  38. void TListDoc::DoUpdate(void)
  39. {
  40.     BeginUpdate(fDocWindow);                // this sets up the visRgn 
  41.     if ( ! EmptyRgn(fDocWindow->visRgn) )    // draw if updating needs to be done 
  42.       {
  43.         DrawWindow();
  44.       }
  45.     EndUpdate(fDocWindow);
  46. }
  47.  
  48. // Draw all objects contained in the list. 
  49.  
  50. void TListDoc::DrawWindow(void)
  51. {
  52.     TObjLink* temp;
  53.     
  54.     SetPort(fDocWindow);
  55.     EraseRect(&fDocWindow->portRect);
  56.     
  57.     if (fObjList->NumObjs() != 0)
  58.         for (temp = fObjList->Header(); 
  59.             temp != nil; temp = temp->GetNext())
  60.           temp->GetmyObj()->Draw(temp->GetmyObj()->GetObjPat());
  61. } // DrawWindow
  62.  
  63.